e!/bin/bash 

variable=$(tail -2 /home/pi/lastReboot  | head -1)
DATE=$(date)
TIMESTAMP=$(date +%s)
wlan='wlan0'
pingip='google.com'
echo  CHECK $DATE >> /tmp/check_reboot_time.log


##################
#################

send_mesage () {


message="REBOOT: $variable"
FROM=raspberrypi12
/home/pi/push.sh "$message"  "$FROM"


} 


/bin/ping -c 1 -I $wlan $pingip > /dev/null 2> /dev/null
if [ $? -ge 1 ] ; then
   
  echo  "No Net" >> /tmp/check_reboot_time.log
  sleep 20
  send_mesage
else
echo  "Net Up"  >> /tmp/check_reboot_time.log
send_mesage
fi

